package com.totoro.microservice.controller;

import com.totoro.microservice.model.User;
import com.totoro.microservice.service.IUserService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by Niki on 2018/10/17 16:38
 */
@RestController
@Api("用户基础服务相关api")
@RequestMapping("/user")
public class UserController {
    @Resource
    IUserService userService;

    @ApiOperation("根据id获取用户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",dataType="Integer",required=true,value="用户的姓名",defaultValue="1")
    })
    @ApiResponses({
            @ApiResponse(code=400,message="请求参数没填好"),
            @ApiResponse(code=404,message="请求路径没有或页面跳转路径不对")
    })
    @GetMapping("/find/{id}")
    User findById(@PathVariable("id") Integer id) {
        return userService.findById(id);
    }
}
